package com.shop.domain.pink;

import com.alibaba.fastjson.annotation.JSONField;
import com.shop.jpa.domain.BaseDomain;
import com.shop.jpa.support.JpaConst;
import com.shop.util.IdSignUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>PinkJishou 实体类</p>
 * <p>Table: t_pink_jishou - </p>
 * @author generator
 * @date 2021-02-22 01:44:56
 */
@ApiModel("t_pink_snap_jishou 实体类")
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "t_pink_snap_jishou")
@SQLDelete(sql = "update t_pink_snap_jishou set is_deleted = 1 where id = ?")
@Where(clause = JpaConst.WHERE_CLAUSE_NOT_DELETED)
@DynamicInsert(true)
@DynamicUpdate(true)
public class PinkSnapJishou extends BaseDomain implements Serializable {

    @ApiModelProperty(value = "id", hidden = true)
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
	@JSONField(serialize=false)
    private Long id;

    /**
	 * 用户 id
	 */
    @ApiModelProperty("用户 id")
	@Column(name = "uid")
    private Long uid;

    /**
	 * 拼团ID
	 */
    @ApiModelProperty("拼团ID")
	@Column(name = "pink_id")
    private Long pinkId;

    /**
     * 拼团记录id
     */
    @ApiModelProperty("拼团记录id")
    @Column(name = "store_pink_id")
    @JSONField(serialize = false)
    private Long storePinkId;

    /**
     * 地址id
     */
    @ApiModelProperty("地址id")
    @Column(name = "user_address_id")
    @JSONField(serialize = false)
    private Long userAddressId;

    /**
	 * 寄售状态0寄售中1提货 2 已完成
	 */
    @ApiModelProperty("寄售状态0寄售中1提货 2 已完成")
	@Column(name = "status")
    private Integer status;

    /**
	 * 寄售金额
	 */
    @ApiModelProperty("寄售金额")
	@Column(name = "jishou_money")
    private BigDecimal jishouMoney;

    /**
     * 寄售金额
     */
    @ApiModelProperty("寄售红包金额")
    @Column(name = "red_package_money")
    private BigDecimal redPackageMoney;

    /**
	 * 订单id
	 */
    @ApiModelProperty("订单id")
	@Column(name = "order_no")
    private String orderNo;

    /**
	 * 商品ID
	 */
    @ApiModelProperty("商品ID")
	@Column(name = "product_id")
    private Long productId;

    /**
	 * 商品规格ID
	 */
    @ApiModelProperty("商品规格ID")
	@Column(name = "product_attr_value_id")
    private Long productAttrValueId;

    /**
	 * 创建时间
	 */
    @ApiModelProperty("创建时间")
	@Column(name = "create_time")
    private Date createTime;

    /**
	 * 修改时间
	 */
    @ApiModelProperty("修改时间")
	@Column(name = "update_time")
    @JSONField(serialize=false)
    private Date updateTime;

    /**
	 * 是否删除
	 */
    @ApiModelProperty("是否删除")
	@Column(name = "is_deleted")
    @JSONField(serialize=false)
    private Integer isDeleted;

    @ApiModelProperty("拼团记录ID")
    @Transient
    private String storePinkSign;
    public String getStorePinkSign() {
        return IdSignUtil.doSign(this.getStorePinkId());
    }

    @ApiModelProperty("收货地址ID")
    @Transient
    private String userAddressSign;
    public String getUserAddressSign() {
        return IdSignUtil.doSign(this.userAddressId);
    }
}